{include file="common:lay_header" / }
{include file="common:upload" / }
<body>
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item">
        <label class="layui-form-label">跳转链接</label>
        <div class="layui-input-block">
            <input type="text" name="click_url" value="{$info.click_url}" lay-verify="required" autocomplete="off" placeholder="请输入跳转链接" class="layui-input">
        </div>
    </div>
    <div class="layui-upload">
        <label class="layui-form-label">图片上传</label>
        <button type="button" class="layui-btn" id="test1">上传图片</button>
        <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo1" width="20%" src="{$info.img}">
            <p id="demoText"></p>
        </div>
        <input type="hidden" id="test2" name="img">
    </div>

    <input type="hidden" name="id" value="{$info.id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
        </div>
    </div>
</form>


<script src="__LAYUI__/layui.js" charset="utf-8"></script>

<script>
    layui.use(['upload','form'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,form = layui.form;

        //普通图片上传
        one_upload(upload,$);

        //监听提交
        form.on('submit(demo1)', function(data){

            let json_field = data.field;

            let url = "{:url('update')}";
            let params = json_field;

            _axios(url,params)
            return false;
        });
    });
</script>

</body>
</html>